<p-panel header="筛选查询" [collapsed]="false" headerClass="bg-eaeaea border-none" maxlength="50" search="模板编号/触发事件"
         [(searchText)]="searchObj.searchValue"  (onSearch)="normalSearchFun();dt.reset();">
  <div class="p-t-20 clearfix">
    <div class="inline-block">
      <span class="p-r-10 opacity06">通知类型：</span>
      <p-dropdown placeholder="全部" styleClass="width-150 m-r-30" [options]="adviceType" [(ngModel)]="selectAdviceType" [ngModelOptions]="{standalone: true}"
                  optionLabel="name" (onChange)='changeAdviceType();normalSearchFun();dt.reset();'></p-dropdown>
    </div>
    <div class="inline-block">
      <span class="p-r-10 opacity06">消息类型：</span>
      <p-dropdown placeholder="全部" styleClass="width-150 m-r-30" [options]="msgType" [(ngModel)]="selectMsgType" [ngModelOptions]="{standalone: true}"
                  optionLabel="name" (onChange)='normalSearchFun();dt.reset();'></p-dropdown>
    </div>

    <div class="inline-block">
      <span class="p-r-10 opacity06">标题：</span>
      <p-dropdown placeholder="全部" styleClass="width-150 m-r-30" [options]="titles" [(ngModel)]="selectTitle" [ngModelOptions]="{standalone: true}"
                  optionLabel="title" (onChange)='normalSearchFun();dt.reset();'></p-dropdown>
    </div>

    <div class="inline-block">
      <span class="p-r-10 opacity06">状态：</span>
      <p-dropdown placeholder="全部" styleClass="width-150 m-r-30" [options]="status" [(ngModel)]="selectStatus" [ngModelOptions]="{standalone: true}"
                  optionLabel="name" (onChange)='normalSearchFun();dt.reset();'></p-dropdown>
    </div>

    <div class="inline-block pull-right">
      <button pButton type="button" (click)="normalSearchFun();dt.reset()" label="查询" class="btn btn-success m-r-10"></button>
    </div>
  </div>
</p-panel>


<p-dataTable #dt scrollable="true" [value]="templates" [totalRecords]="totalRecords" [lazy]="true" [marginHeight]="20" (onLazyLoad)="onPage($event)"
             [paginator]="true" [headerCheckboxToggleAllPages]="true" [(selection)]="selectedRowData">
  <p-header>
    <button pButton type="button" (click)="newTemplate()" label="新建" class="btn btn-secondary"></button>
    <button pButton type="button" (click)="toggleEffect('禁用',false)" label="禁用" class="btn btn-secondary"></button>
    <button pButton type="button" (click)="toggleEffect('启用',true)" label="启用" class="btn btn-secondary"></button>
  </p-header>
  <p-column [style]="{'width':'46px'}" selectionMode="multiple"></p-column>
  <p-column *ngFor="let col of dataHead" [field]='col.field' [header]='col.header' [hidden]="col.hidden" [sortable]="col.sortable"
            [style]="{'width':col.width}">
    <ng-template let-index='rowIndex' let-data='rowData' pTemplate='body' *ngIf="col.tem">
      <div *ngIf="col.field === 'code'">
        <a class="color-1a91eb" [title]="data[col.field]" target="_blank" [routerLink]="['/saas/engineer/msgTemplate/template', data.id]">
          {{data.code}}
        </a>
      </div>
      <div *ngIf="col.field === 'adviceType'">
        {{storage.dicFilter('advicetype',data[col.field])}}
      </div>
      <div *ngIf="col.field === 'msgType'">
        <div *ngIf="data.adviceType === 'advicetype_180309000011'">
            {{storage.dicFilter('msgtype_order',data[col.field])}}
        </div>
        <div *ngIf="data.adviceType === 'advicetype_180309000012'">
          {{storage.dicFilter('msgtype_sys',data[col.field])}}
        </div>
        <div *ngIf="data.adviceType === 'advicetype_180309000013'">
          {{storage.dicFilter('msgtype_engineering',data[col.field])}}
        </div>
      </div>
      <div *ngIf="col.field === 'isEffect'">
        {{data.isEffect ? '启用' : '禁用'}}
      </div>
    </ng-template>
  </p-column>
</p-dataTable>


